import java.util.Arrays;
import java.util.Scanner;

public class 索引 {
    public static void main(String[] args) {
        int[] arr = {19,28,37,46,50};
        System.out.println("原数组为"+ Arrays.toString(arr));
        decideArray(arr);
    }

    public static void decideArray(int[] arr) {
        Scanner sc=new Scanner(System.in);
        System.out.println("请输入你要查找的元素");
        int inputNumber=sc.nextInt();
        int count=0;
        for (int i = 0; i < arr.length; i++) {
            if (inputNumber==arr[i]){
                System.out.println("查找成功，索引为："+i);
                count++;
                break;
            }else if (inputNumber!=arr[i]){
            }
        }
        if (count++==0){
            System.out.println("-1");
        }
    }
}
